*** REPLICATION TOOLKIT ***

* AUTHORS: CIMINELLI DUVAL FURCERI 

* ARTICLE: EMPLOYMENT PROTECTION DEREGULATION AND LABOR SHARES IN ADVANCED ECONOMIES 

* JOURNAL: REVIEW OF ECONOMICS AND STATISTICS

* OUTPUT: FIGURE 3, PANEL A

***************************

cd ""

global horizon 6 
global ci = 1.645

use "DTA files/Dataset strikes - industry level", clear

************* CLEAN DATASET ******************

* Drop industries with few observations
drop if code == "O" | code == "P" | code == "Q" | code == "S"

* Drop Agriculture & Construction (excluded from the analysis due to different EPL regulation)
drop if code == "A" | code == "F"

* Drop Real Estate (unreasonably high layoff rate)
drop if code == "L"

* Adjust employment variables
replace EMP = . if EMP == 0
replace EMPE = . if EMPE == 0

xtset id_cross_section year

************ PREPARE VARIABLES **********

* Disputes days lost
tssmooth ma Y = DisputesDaysLost, window(2 1 2) replace
replace Y = Y/EMP

* Dependent variables
forvalues i = 1 / $horizon {
local sc = `i'-1
gen Y`i' = 100*log(f`sc'.Y+1)
}

* Lags dependent variable
foreach v in Y {
forvalues l = 1 / 4 {
gen l`l'`v' = l`l'.`v'1
}
}

* Main explanatory variable (EPL reform regular contract interacted with industry-specific characteristics) 
* normalized so to show differential responses between 25th and 75th percentiles
quietly sum layoff_rate_1, det
local sc1 = r(p75)
local sc2 = r(p25)
gen r2 = (EPLregularworkers*layoff_rate_1)/(`sc1'-`sc2')  

* Lags and forwards of explanatory variables
forvalues s = 2/2 {
forvalues l = 1 / 4 {
gen l`l'r`s' = l`l'.r`s'
}
forvalues f = 1 / 5 {
gen f`f'r`s' = f`f'.r`s'
}
}

* Global for forward variables (Teulings and Zubanov)
forvalues s = 2/2 {
global f1`s'
global f2`s' f1r`s'
global f3`s' f1r`s' f2r`s'
global f4`s' f1r`s' f2r`s' f3r`s'
global f5`s' f1r`s' f2r`s' f3r`s' f4r`s'
global f6`s' f1r`s' f2r`s' f3r`s' f4r`s' f5r`s'
}

* EPL reform temporary contract, interacted with industry-specific characteristics
gen t2 = EPLtemporaryworkers*layoff_rate_1

************ ANALYSIS AND GRAPH - STRIKES **********

matrix baseline = J($horizon,4,.)

forvalues i= 1/$horizon {
reghdfe  Y`i' r2 l1Y l2Y l3Y l4Y l1r2 l2r2 l3r2 l4r2 t2 ${f`i'2}, absorb(id_cross_section i.year#ifscode i.year#id_ind) cluster(ifscode year) nocons
matrix results = r(table)
matrix baseline[`i',1] = results[1,1]
matrix baseline[`i',2] = results[2,1]
matrix baseline[`i',3] = results[1,1] + $ci*results[2,1]
matrix baseline[`i',4] = results[1,1] - $ci*results[2,1]
}
capture drop coeff2 ci_p2 ci_n2
matrix coeff2 = baseline[1...,"c1"]
matrix ci_p2 = baseline[1...,"c3"]
matrix ci_n2 = baseline[1...,"c4"]
svmat coeff2
svmat ci_p2
svmat ci_n2
capture drop horizon
egen horizon = group(year) 
replace horizon = . if coeff21==.

* Create graph
graph set window fontface "Times New Roman"
graph twoway line coeff2 ci_p2 ci_n2 horizon, graphregion(color(white)) ytitle("") xtitle("") yline(0, lcolor(black)) xlabel(, nolabels) legend(off) ///
lpattern(solid shortdash shortdash) lwidth (thick thick thick) lcolor(blue red red) ytitle("% change", height(5)) subtitle("{bf:Panel A.} Days lost due to strike activity") ysize(10) xsize(15)
graph copy A, replace
